<?php

namespace app\admin\model\advertiser;

use app\BaseModel;

class AdvertiserSecondaryLog extends BaseModel
{

    /**
     * 判断二次关注是否存在
     * @param int $user_id
     * @param string $third_id
     * @return bool
     */
    public static function itExist(int $user_id, string $third_id): bool
    {
        //查询日志是否存在
        $where = ['user_id' => $user_id, 'third_id' => $third_id];
        $res = self::findOne($where);
        if ($res) {
            return true;
        }
        return false;
    }


    /**
     * 写入取号日志
     * @param int $user_id
     * @param int $third_id
     * @param string $mac_id
     * @return int
     */
    public static function AccountLog(int $user_id, int $third_id, string $mac_id): int
    {
        //写入日志
        $temp_log = [
            'third_id' => $third_id,
            'user_id' => $user_id,
            'mac_id' => $mac_id,
            'create_time' => time(),
        ];
        self::insertGetId($temp_log);
        return 2;
    }
}